struct CustomSmartPointer {
    data: String,
}

impl Drop for CustomSmartPointer {
    fn drop(&mut self) {
        println!("Dropping CustomSmartPointer with data `{}`!", self.data);
    }
}

fn main() {
    let b = CustomSmartPointer {
        data: String::from("some data"),
    };
    let c = CustomSmartPointer {
        data: String::from("my stuff"),
    };
    let d = CustomSmartPointer {
        data: String::from("other stuff"),
    };

    println!("CustomSmartPointers created.");
    // 通过std::mem::drop提前丢弃值
    drop(b);
    println!("CustomSmartPointers dropped before the end of main.");
}
// 通过清理代码的打印输出可以看出，信息存放在栈上
